package com.cate.constants;

import com.cate.context.BaseContext;
import com.cate.pojo.dto.ShoppingCartDTO;

/**
 * @CreateTime: 2023/7/30
 * @Author: <==lhd==>
 * @Description: redis常量
 */
public class RedisConstant {
    /**
     * 店铺状态
     */
    public final static String SHOP_STATUS_KEY = "SHOP_STATUS";

    /**
     * 分类前缀
     */
    public final static String SHOPPING_CART_PREFIX = "ShoppingCart:";

    public static String getShoppingCartPrefix(ShoppingCartDTO shoppingCartDTO){
        // 获得本地用户ID
        final Long userId = BaseContext.getCurrentId();

        if(shoppingCartDTO.getDishId()!=null){
            return SHOPPING_CART_PREFIX+userId+":"+"dishId:"+shoppingCartDTO.getDishId();
        }else{
            return SHOPPING_CART_PREFIX+userId+":"+"setmealId:"+shoppingCartDTO.getSetmealId();
        }
    }


}
